<!--
- Author:  LiShibin.
- Date:    2017/7/27 0027.
- File:    pay.
-->
<template>
  <div v-show="show">
    <div class="PopBg z99" style="z-index: 999" id="PopBg"></div>
    <div class="MethodPayment BottomGd bg_fff z100 xd " style="z-index: 1000">
      <div class="iconfont icon-close tc" @click="closePop"></div>
      <ul>
        <li class="pl20">
          <i class="iconfont icon-money2 fl mr10"></i><span class="lh100 f26 cr_595757 fl">选择支付方式</span>
        </li>
        <li :class="{'on': payType == 0}" @click="switchPayType(0)">
          <div class="LeftIcon fl"><i class="iconfont icon-wechat cr_18aa04"></i></div>
          <div class="fl lh100 f26 cr_595757 ml5"> 微信支付 </div>
          <div class="select fr lh100 pr20"><i class="iconfont icon-select"></i></div>
        </li>
        <!--<li :class="{'on': payType == 1}" @click="switchPayType(1)">-->
          <!--<div class="LeftIcon fl"><i class="iconfont icon-nonghang cr_18aa04"></i></div>-->
          <!--<div class="fl lh100 f26 cr_595757 ml5"> 农行支付 </div>-->
          <!--<div class="select fr lh100 pr20"><i class="iconfont icon-select"></i></div>-->
        <!--</li>-->
      </ul>
      <button type="button" class="but_2 wauto bg_45a73a mt10" @click="pay">立即支付</button>
    </div>
  </div>
</template>

<script>
  export default{
    data() {
      return {
        show: true,
        param: {}, // {paySn: '', orderId: '', buyType: ''}
        payType: 0, // 0 微信， 1 农行
        closedHandle: function () {
        }
      }
    },
    components: {},
    methods: {
      switchPayType(type) {
        this.payType = type
      },
      switchShowPay(boolValue) {
        this.show = boolValue
      },
      closePop() {
        this.switchShowPay(false)
        this.closedHandle()
      },
      pay() {
        this.switchShowPay(false)
        if (this.payType == 0) {
          this.$native.weixinPay({paySn: this.param.paySn}).then(data => {
            this.$router.push({name: 'order-success', params: {id: this.param.orderId}})
          }).catch(e => {
            this.$toast('支付失败:' + e.msg)
          })
        } else if (this.payType == 1) {
          this.$native.nonghangPay({paySn: this.param.paySn})
        }
      }
    }
  }
</script>

<style>

</style>